package com.zhuiyun.project.api.appusermessage.controller;

import com.zhuiyun.project.api.appusermessage.model.UserMessageModel;
import com.zhuiyun.project.api.appusermessage.service.impl.UserMessageServiceImpl;
import com.zhuiyun.project.common.response.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName UserMessageController
 * @Description TODO
 * @Author Root
 * @Date 2023/6/26 14:40
 **/
@RestController
@RequestMapping("userPass")
@CrossOrigin
public class UserMessageController {
    @Autowired
    UserMessageServiceImpl userMessageService;
    /**
    * @Author Root
    * @Description 通过id获取用户信息
    * @Date 2023/7/24 19:21
    * @Return com.zhuiyun.project.common.response.CommonResult
    * @param id
    */
    @GetMapping("/getUserById")
    public CommonResult getUserById(Integer id){
        return userMessageService.getUserById(id);
    }
    /**
    * @Author Root
    * @Description 修改用户的个人信息
    * @Date 2023/7/24 19:21
    * @Return com.zhuiyun.project.common.response.CommonResult
    * @param goodsImg
    * @param userMessageModel
    */
    @PostMapping("/updateUser")
    public CommonResult updateUser(MultipartFile goodsImg, UserMessageModel userMessageModel){
        return userMessageService.updateUser(goodsImg,userMessageModel);
    }
    /**
    * @Author Root
    * @Description 修改个人信息
    * @Date 2023/7/24 20:26
    * @Return com.zhuiyun.project.common.response.CommonResult
    * @param userMessageModel
    */
    @PostMapping("/updateMessage")
    public CommonResult updateMessage(@RequestBody UserMessageModel userMessageModel) {
        return userMessageService.updateMessage(userMessageModel);
    }
}
